#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
 struct ListNode {
      int val;
      struct ListNode *next;
  };
 
int kthToLast(struct ListNode* head, int k) {
    struct ListNode* new = head;
    int x = 0;
    while (new) {
        new = new->next;
        x++;
    }
    new = head;
    for (int i = 0; i < (x - k); i++) {
        new = new->next;
    }
    return new->val;
}
void Push(struct ListNode** node, int i) {
    struct ListNode* new = malloc(sizeof(struct ListNode));
    new->val = i;
    new->next = *node;
    *node = new;
}
void deleteNode(struct ListNode* node) {
    struct ListNode* new = node->next;
    node->val = new->val;
    node->next = new->next;
    free(new);
}
int main() {
    struct ListNode* new = malloc(sizeof(struct ListNode));
    new->val = 0;
    new->next = NULL;
    Push(&new, 1);
    Push(&new, 2);
    printf("%d", kthToLast(new, 1));
}